package lib.quasar.db.table;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;

import lib.quasar.context.BaseConstant;

/**
 * description: 用户信息
 * created by kalu on 2018/4/8 17:47
 */
@Entity
public class User {

    @Id(autoincrement = true) // 主键自增
    private Long id_;

    private Long patientid;
    private Long doctorid;

    private Integer sex;
    private Integer height;
    private Integer weight;
    private Integer provinceid;
    private Integer cityid;
    private Integer regionid;

    private String icard;
    private String clientid;
    private String hospital_name;
    private String age;
    private String phone;
    private String icon;
    private String nick;
    private String real_name;
    private String birthday;
    private String address;
    private String blood_type;
    private String remark;
    private String create_time;
    private String update_time;
    private String supervisor_doctor;
    private String protopathy;
    private String doctor_name;
    private String donor_receptor_type;
    private String source_type;
    private String operation_date;
    private String transplant_type;
    private String hospitalid;
    private String commonid;
    private String common_name;
    private String description;
    private String operation_length;

    @Generated(hash = 586692638)
    public User() {
    }

    @Generated(hash = 1950197565)
    public User(Long id_, Long patientid, Long doctorid, Integer sex, Integer height, Integer weight, Integer provinceid, Integer cityid, Integer regionid, String icard, String clientid, String hospital_name, String age, String phone, String icon, String nick, String real_name, String birthday, String address, String blood_type, String remark, String create_time, String update_time, String supervisor_doctor, String protopathy, String doctor_name, String donor_receptor_type, String source_type, String operation_date, String transplant_type, String hospitalid, String commonid, String common_name, String description, String operation_length) {
        this.id_ = id_;
        this.patientid = patientid;
        this.doctorid = doctorid;
        this.sex = sex;
        this.height = height;
        this.weight = weight;
        this.provinceid = provinceid;
        this.cityid = cityid;
        this.regionid = regionid;
        this.icard = icard;
        this.clientid = clientid;
        this.hospital_name = hospital_name;
        this.age = age;
        this.phone = phone;
        this.icon = icon;
        this.nick = nick;
        this.real_name = real_name;
        this.birthday = birthday;
        this.address = address;
        this.blood_type = blood_type;
        this.remark = remark;
        this.create_time = create_time;
        this.update_time = update_time;
        this.supervisor_doctor = supervisor_doctor;
        this.protopathy = protopathy;
        this.doctor_name = doctor_name;
        this.donor_receptor_type = donor_receptor_type;
        this.source_type = source_type;
        this.operation_date = operation_date;
        this.transplant_type = transplant_type;
        this.hospitalid = hospitalid;
        this.commonid = commonid;
        this.common_name = common_name;
        this.description = description;
        this.operation_length = operation_length;
    }

    /********************************************************************************************/

    public Boolean needGuide() {
        return null == patientid;
    }

    public void setGuide(boolean needGuide) {
        patientid = (needGuide ? null : 0L);
    }

    public Boolean needLogin() {
        return null == patientid || patientid.longValue() == 0L;
    }

    public Boolean needCompile() {
        return null == real_name;
    }

    public void updateInfo(final User news) {
        if (null != news.getPatientid()) {
            this.patientid = news.getPatientid();
        }
        if (null != news.getDoctorid()) {
            this.doctorid = news.getDoctorid();
        }
        if (null != news.getIcard()) {
            this.icard = news.getIcard();
        }
        if (null != news.getSex()) {
            this.sex = news.getSex();
        }
        if (null != news.getHeight()) {
            this.height = news.getHeight();
        }
        if (null != news.getWeight()) {
            this.weight = news.getWeight();
        }
        if (null != news.getProvinceid()) {
            this.provinceid = news.getProvinceid();
        }
        if (null != news.getCityid()) {
            this.cityid = news.getCityid();
        }
        if (null != news.getRegionid()) {
            this.regionid = news.getRegionid();
        }
        if (null != news.getClientid()) {
            this.clientid = news.getClientid();
        }
        if (null != news.getHospital_name()) {
            this.hospital_name = news.getHospital_name();
        }
        if (null != news.getAge()) {
            this.age = news.getAge();
        }
        if (null != news.getPhone()) {
            this.phone = news.getPhone();
        }
        if (null != news.getIcon()) {
            this.icon = news.getIcon();
        }
        if (null != news.getNick()) {
            this.nick = news.getNick();
        }
        if (null != news.getReal_name()) {
            this.real_name = news.getReal_name();
        }
        if (null != news.getBirthday()) {
            this.birthday = news.getBirthday();
        }
        if (null != news.getAddress()) {
            this.address = news.getAddress();
        }
        if (null != news.getBlood_type()) {
            this.blood_type = news.getBlood_type();
        }
        if (null != news.getRemark()) {
            this.remark = news.getRemark();
        }
        if (null != news.getCreate_time()) {
            this.create_time = news.getCreate_time();
        }
        if (null != news.getUpdate_time()) {
            this.update_time = news.getUpdate_time();
        }
        if (null != news.getSupervisor_doctor()) {
            this.supervisor_doctor = news.getSupervisor_doctor();
        }
        if (null != news.getProtopathy()) {
            this.protopathy = news.getProtopathy();
        }
        if (null != news.getDoctor_name()) {
            this.doctor_name = news.getDoctor_name();
        }
        if (null != news.getDonor_receptor_type()) {
            this.donor_receptor_type = news.getDonor_receptor_type();
        }
        if (null != news.getSource_type()) {
            this.source_type = news.getSource_type();
        }
        if (null != news.getOperation_date()) {
            this.operation_date = news.getOperation_date();
        }
        if (null != news.getTransplant_type()) {
            this.transplant_type = news.getTransplant_type();
        }
        if (null != news.getHospitalid()) {
            this.hospitalid = news.getHospitalid();
        }
        if (null != news.getCommonid()) {
            this.commonid = news.getCommonid();
        }
        if (null != news.getCommon_name()) {
            this.common_name = news.getCommon_name();
        }
        if (null != news.getDescription()) {
            this.description = news.getDescription();
        }
        if (null != news.getOperation_length()) {
            this.operation_length = news.getOperation_length();
        }
    }

    public void reset() {
        patientid = null;
        clientid = null;
        icon = null;
        real_name = null;
        birthday = null;
        phone = null;
        age = null;
        sex = null;
    }

    public String getUrl() {
        return BaseConstant.API_URL + icon;
    }

    public String getSexs() {
        if (null == sex) {
            return "";
        }
        if (sex.equals(1)) {
            return "男";
        } else {
            return "女";
        }
    }

    public void setSexs(String sex) {
        if (null == sex) {
            setSex(null);
        }
        if ("男".equals(sex)) {
            setSex(1);
        } else {
            setSex(0);
        }
    }

    public String getCards() {
        if (null == icard) {
            return null;
        } else {
            return String.valueOf(icard);
        }
    }

    /********************************************************************************************/

    public Long getId_() {
        return id_;
    }

    public void setId_(Long id_) {
        this.id_ = id_;
    }

    public Long getPatientid() {
        return patientid;
    }

    public void setPatientid(Long patientid) {
        this.patientid = patientid;
    }

    public Long getDoctorid() {
        return doctorid;
    }

    public void setDoctorid(Long doctorid) {
        this.doctorid = doctorid;
    }

    public String getIcard() {
        return icard;
    }

    public void setIcard(String icard) {
        this.icard = icard;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public Integer getHeight() {
        return height;
    }

    public void setHeight(Integer height) {
        this.height = height;
    }

    public Integer getWeight() {
        return weight;
    }

    public void setWeight(Integer weight) {
        this.weight = weight;
    }

    public Integer getProvinceid() {
        return provinceid;
    }

    public void setProvinceid(Integer provinceid) {
        this.provinceid = provinceid;
    }

    public Integer getCityid() {
        return cityid;
    }

    public void setCityid(Integer cityid) {
        this.cityid = cityid;
    }

    public Integer getRegionid() {
        return regionid;
    }

    public void setRegionid(Integer regionid) {
        this.regionid = regionid;
    }

    public String getClientid() {
        return clientid;
    }

    public void setClientid(String clientid) {
        this.clientid = clientid;
    }

    public String getHospital_name() {
        return hospital_name;
    }

    public void setHospital_name(String hospital_name) {
        this.hospital_name = hospital_name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    public String getReal_name() {
        return real_name;
    }

    public void setReal_name(String real_name) {
        this.real_name = real_name;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getBlood_type() {
        return blood_type;
    }

    public void setBlood_type(String blood_type) {
        this.blood_type = blood_type;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getCreate_time() {
        return create_time;
    }

    public void setCreate_time(String create_time) {
        this.create_time = create_time;
    }

    public String getUpdate_time() {
        return update_time;
    }

    public void setUpdate_time(String update_time) {
        this.update_time = update_time;
    }

    public String getSupervisor_doctor() {
        return supervisor_doctor;
    }

    public void setSupervisor_doctor(String supervisor_doctor) {
        this.supervisor_doctor = supervisor_doctor;
    }

    public String getProtopathy() {
        return protopathy;
    }

    public void setProtopathy(String protopathy) {
        this.protopathy = protopathy;
    }

    public String getDoctor_name() {
        return doctor_name;
    }

    public void setDoctor_name(String doctor_name) {
        this.doctor_name = doctor_name;
    }

    public String getDonor_receptor_type() {
        return donor_receptor_type;
    }

    public void setDonor_receptor_type(String donor_receptor_type) {
        this.donor_receptor_type = donor_receptor_type;
    }

    public String getSource_type() {
        return source_type;
    }

    public void setSource_type(String source_type) {
        this.source_type = source_type;
    }

    public String getOperation_date() {
        return operation_date;
    }

    public void setOperation_date(String operation_date) {
        this.operation_date = operation_date;
    }

    public String getTransplant_type() {
        return transplant_type;
    }

    public void setTransplant_type(String transplant_type) {
        this.transplant_type = transplant_type;
    }

    public String getHospitalid() {
        return hospitalid;
    }

    public void setHospitalid(String hospitalid) {
        this.hospitalid = hospitalid;
    }

    public String getCommonid() {
        return commonid;
    }

    public void setCommonid(String commonid) {
        this.commonid = commonid;
    }

    public String getCommon_name() {
        return common_name;
    }

    public void setCommon_name(String common_name) {
        this.common_name = common_name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getOperation_length() {
        return operation_length;
    }

    public void setOperation_length(String operation_length) {
        this.operation_length = operation_length;
    }

    /***********************************************************************************/

    @Override
    public String toString() {
        return "User{" +
                "id_=" + id_ +
                ", patientid=" + patientid +
                ", doctorid=" + doctorid +
                ", sex=" + sex +
                ", height=" + height +
                ", weight=" + weight +
                ", provinceid=" + provinceid +
                ", cityid=" + cityid +
                ", regionid=" + regionid +
                ", clientid='" + clientid + '\'' +
                ", hospital_name='" + hospital_name + '\'' +
                ", age='" + age + '\'' +
                ", phone='" + phone + '\'' +
                ", icon='" + icon + '\'' +
                ", nick='" + nick + '\'' +
                ", real_name='" + real_name + '\'' +
                ", birthday='" + birthday + '\'' +
                ", address='" + address + '\'' +
                ", blood_type='" + blood_type + '\'' +
                ", remark='" + remark + '\'' +
                ", create_time='" + create_time + '\'' +
                ", update_time='" + update_time + '\'' +
                ", supervisor_doctor='" + supervisor_doctor + '\'' +
                ", protopathy='" + protopathy + '\'' +
                ", doctor_name='" + doctor_name + '\'' +
                ", donor_receptor_type='" + donor_receptor_type + '\'' +
                ", source_type='" + source_type + '\'' +
                ", operation_date='" + operation_date + '\'' +
                ", transplant_type='" + transplant_type + '\'' +
                ", hospitalid='" + hospitalid + '\'' +
                ", commonid='" + commonid + '\'' +
                ", common_name='" + common_name + '\'' +
                ", description='" + description + '\'' +
                ", operation_length='" + operation_length + '\'' +
                '}';
    }
}
